<template>
  <view>
    <view
        :style="'padding-top:' + nTop + 'px;padding-bottom:' + topbar2_btm + 'px;height:' + nHeight + 'px;line-height:' + nHeight + 'px'"
        class="logobox"
        @tap="backtopFn">
      <view v-if="topbar2" :style="color + ';--rgbcolor:' + rgbcolor" class="topbar2">
        <text v-for="(item, index) in topbar" :key="index" :class="'item ' + (currentTab === index ? 'active' : '')"
              :data-F="item.f" @tap.stop.prevent="topbarFn">
          {{ item.title }}
        </text>
      </view>
      <view v-else :class="agent_class">
        <view class="logo">
          <!-- <image :src="dataObj.logo" mode="heightFix"></image>-->
        </view>
        <view class="text">
          {{ dataObj.siteName }}
          <text v-if="!globalUtils.empty(AGENT)" class="ico jt"></text>
        </view>
      </view>
    </view>
    <view v-if="(!globalUtils.empty(dataObj))"
          :style="'margin-top:' + nTH + 'px;--color:' + color + ';--rgbcolor:' + rgbcolor"
          class="topbar">
      <text v-for="(item, index) in topbar" :key="index" :class="'item ' + (currentTab === index ? 'active' : '')"
            @tap="topbarFn(item.f)"> {{ item.title }}
      </text>
<!--      <text :class="'item ' + (currentTab === index ? 'active' : '')"-->
<!--            @tap="topbarFn('emotion')"> 情感经纪人-->
<!--      </text>-->
      <view class="more" @tap="topbar_moreFn">
        <i class="ico"></i>
      </view>
    </view>
    <view v-if="if_div_top" :class="'mask1 ' + div_top_mask_class" @tap.stop.prevent="div_top_close_Fn">
      <view :class="'div_top TRnav ' + div_top_box_class" @tap.stop.prevent="blankFn">
        <view class="trline"></view>
        <block v-for="(item, index) in TRnav" :key="index">
          <navigator v-if="item.tabBar == 1" :url="item.url" class="a" hoverClass="none" openType="switchTab">
            <view :class="'i' + (item.title == '我的' ? ' _my' : '')">
              <image :src="item.icopath" mode="aspectFill"></image>
            </view>
            <view class="span">{{ item.title }}</view>
          </navigator>
          <navigator v-else :url="item.url" class="a" hoverClass="none">
            <view class="i">
              <image :src="item.icopath" mode="aspectFit"></image>
              <text v-if="item.new == 1" class="b">新</text>
            </view>
            <view class="span">{{ item.title }}</view>
          </navigator>
        </block>
        <view class="h4">服务大厅</view>
        <view class="tabbar" @tap.stop.prevent="div_top_close_Fn"></view>
      </view>
    </view>

    <view v-if="agentbox && !globalUtils.empty(AGENT)" :class="'mask1 ' + agentbox_mask_class"
          @tap.stop.prevent="agentbox_close_Fn">
      <view :class="'div_top TRnav agentbox ' + agentbox_box_class" @tap.stop.prevent="blankFn">
        <view class="trline"></view>
        <view :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" class="agentC2">
          <view v-for="(itemA, itemAindex) in AGENT.list" v-if="itemAindex <= 3"
                :key="itemAindex" :class="'li' + (itemA.id == aid ? ' lied' : '')">
            <view class="em" @tap.stop.prevent="agent_detailFn(itemA)">
              <image :src="itemA.path_b_url" mode="aspectFill"></image>
              <text class="detail">{{ itemA.btndetail }}</text>
            </view>

            <view v-if="itemA.id == aid" class="edico ico"></view>

            <view class="h2">{{ itemA.title }}</view>

            <view :data-aid="itemA.id" class="span add" @tap.stop.prevent="aidFn">
              {{ itemA.btnstie }}
              <text class="i ico"></text>
            </view>
          </view>
          <view v-if="AGENT.list.length > 4" class="more" @tap.stop.prevent="aidmoreFn">更多门店</view>
        </view>
        <view class="h4">{{ AGENT.tbody }}</view>
        <view class="tabbar" @tap.stop.prevent="agentbox_close_Fn"></view>
      </view>
    </view>
    <swiper
        v-if="banner.length > 0"
        :autoplay="true"
        :circular="true"
        :indicatorDots="true"
        :style="'height:' + banner_H + 'px;'"
        class="banner"
        duration="1000"
        indicatorActiveColor="#fff"
        indicatorColor="#fff"
        interval="3000"
    >
      <swiper-item v-for="(item, banner_idx) in banner" :key="banner_idx">
        <navigator :url="item.url" hoverClass="none">
          <image :id="'img' + banner_idx" :src="item.img" mode="widthFix"></image>
        </navigator>
      </swiper-item>
    </swiper>
    <view v-if="navdiy_index.length > 0" class="inav">
      <navigator
          v-for="(item, index) in navdiy_index"
          :key="index"
          :appId="item.appid"
          :openType="item.opentype"
          :path="item.pagePath"
          :target="item.target"
          :url="item.pagePath"
          hoverClass="none"
      >
        <image :src="item.img" mode="widthFix"></image>
        <text>{{ item.t }}</text>
      </navigator>
    </view>
<!--    <view style="font-size: 80rpx" @tap="atop">进入表单页面</view>-->
    <view v-if="!globalUtils.empty(IZT)" :style="'--color:' + color + ';--rgbcolor:' + rgbcolor"
          class="iztbox marginbottom40">
      <view class="ul">
        <navigator v-if="!globalUtils.empty(IZT.party)" :url="'/pagesA/party/party_detail?fid=' + IZT.party.id"
                   hoverClass="none">
          <view class="em">
            <view class="bg"></view>
            <image :src="IZT.party.path_s" mode="aspectFill"></image>
            <view class="detail">相亲活动</view>
            <view class="j">
              <text class="span">线下</text>
            </view>
          </view>
          <view class="title">{{ IZT.party.title }}</view>
          <view class="ulist">
            <image v-for="(item, index) in IZT.party.ulist" :key="index" :src="item" mode="aspectFill"></image>
          </view>
        </navigator>
        <navigator v-if="!globalUtils.empty(IZT.huxuan)" :url="'/hnPages/huxuan/huxuan_detail?id=' + IZT.huxuan.id"
                   hoverClass="none">
          <view class="em">
            <view class="bg"></view>
            <image :src="IZT.huxuan.path_s" mode="aspectFill"></image>
            <view class="detail">线上互选</view>
            <view class="j">
              <text class="span">互选</text>
            </view>
          </view>
          <rich-text :nodes="IZT.huxuan.title" class="title"></rich-text>
          <view class="ulist">
            <image v-for="(item, index) in IZT.huxuan.ulist" :key="index" :src="item" mode="aspectFill"></image>
          </view>
        </navigator>
        <navigator v-if="!globalUtils.empty(IZT.manghe)" :url="'/pagesA/manghe/manghe?id=' + IZT.manghe.id"
                   hoverClass="none">
          <view class="em">
            <view class="bg"></view>
            <image :src="IZT.manghe.path_s" mode="aspectFill"></image>
            <view class="detail">取出缘分</view>
            <view class="j">
              <text class="span">纸条</text>
            </view>
          </view>
          <rich-text :nodes="IZT.manghe.title" class="title"></rich-text>
          <view class="ulist">
            <image v-for="(item, index) in IZT.manghe.ulist" :key="index" :src="item" mode="aspectFill"></image>
          </view>
        </navigator>
      </view>
    </view>
    <view v-if="RENQI.userList" :style="'--color:' + color + ';--rgbcolor:' + rgbcolor"
          class="box margintop20 marginbottom40">
      <view class="i_box">
        <view v-for="( item,index ) in RENQI.renqiList " :key="item.id"
              :class="['a',{'ed':rankingActiveIndex === index}]" @tap="onTabs(item,index)">
          {{ item.title }}
        </view>
      </view>
      <view class="zhiding" @tap="onRanking">
        <navigator v-for="(item, index) in RENQI.userList" :key="index"
                   hoverClass="none">
          <image :src="item.photo_s_url" class="m" mode="aspectFill"></image>
          <view class="zl">
            <text class="font">{{ item.nickname }}</text>
            <text class="span">{{ item.birthday }} {{ item.areatitle_str }}</text>
          </view>
        </navigator>
        <view class="more">
          <text class="span">浏览更多嘉宾</text>
          <text class="i ico"></text>
        </view>
      </view>
    </view>
    <view v-if="TOP3.length > 0" :style="'--color:' + color + ';--rgbcolor:' + rgbcolor"
          class="box margintop20 marginbottom40">
      <view class="i_box">
        <view class="a ed" @tap="top3Fn">
          置顶嘉宾
          <view class="span ico">
            <block v-if="TOP3loading">
              <image class="loading_ico" src="/static/res/img/loading_ico.svg"></image>
              <text>换一批</text>
            </block>
            <block v-else> 换一批</block>
          </view>
        </view>
        <view class="h5">
          <navigator class="applytop" hoverClass="none" url="/myPages/top/top">
            我要置顶
            <text class="i ico"></text>
          </navigator>
        </view>
      </view>
      <view class="zhiding">
        <navigator v-for="(item, index) in TOP3" :key="index" :url="'/pagesA/u/u?uid=' + item.uid" hoverClass="none">
          <image :src="item.photo_s" class="m" mode="aspectFill"></image>

          <view class="zl">
            <text class="font">{{ item.nickname }}</text>
            <text class="span">{{ item.age }} {{ item.areatitle }}</text>
          </view>
        </navigator>
      </view>
    </view>
    <view v-if="ARR_index.length > 0"
          :style="'--color:' + color + ';--rgbcolor:' + rgbcolor + ';display:flex;flex-direction: column;'"
          class="box margintop20">
      <view class="i_box">
        <navigator class="a ed" hoverClass="none" openType="switchTab" url="../user/user">推荐嘉宾</navigator>
        <block v-if="dataObj.iModuleU==1">
          <text class="a" data-sokind="gps" @tap="index_parFn">附近的</text>
          <text class="a" data-sokind="match" @tap="index_parFn">匹配我</text>
        </block>
        <block v-else>
          <text class="a" data-sex="1" data-sokind="ext" @tap="index_parFn">男嘉宾</text>
          <text class="a" data-sex="2" data-sokind="ext" @tap="index_parFn">女嘉宾</text>
        </block>
        <view v-if="dataObj.ifps==0" class="h5">
          <navigator class="applytop" hoverClass="none" url="/myPages/refresh/refresh">
            我要上榜
            <text class="i ico"></text>
          </navigator>
        </view>
      </view>
      <view v-if="dataObj.showtype==='1'" :class="'list'+(dataObj.showtype)">
        <Member :list="waterfallList" :nikbg="nikbg"></Member>
      </view>
      <view v-else :class="'list'+(dataObj.showtype)">
        <block v-for="(dl, index) in ARR_index" v-if="ARR_index.length > 0" :key="index">
          <navigator v-for="(item, index1) in dl" :key="index1" :url="'/pagesA/u/u?uid=' + item.uid" class="a"
                     hoverClass="none">
            <block v-if="dataObj.showtype==='2'">
              <image v-if="item.rz_store.length > 0" :src="item.rz_store" class="rz_store"></image>
              <view class="dt">
                <image :src="item.photo_m" class="m" mode="aspectFill"></image>
                <image v-if="!globalUtils.empty(item.vipj)" :src="item.vipj" class="vipj" mode="widthFix"></image>
              </view>
              <image v-if="!globalUtils.empty(item.rzj)" :src="item.rzj" class="rzj" mode="aspectFit"></image>
              <view class="dd">
                <view class="h4">
                  <text class="span">{{ item.nickname }}</text>
                  <image :src="item.grade_ico" class="ugrade1" mode="aspectFit"></image>
                </view>
                <text class="h6">{{ item.datainfo }}</text>
                <text class="h5">
                  <text
                      v-for="(rs2, index2) in item.hobby"
                      :key="index2"
                      :style="'color:' + color + ';background-color:rgba(' + rgbcolor + ',.05);border-color:rgba(' + rgbcolor + ',.1);'"
                      class="li"
                  >
                    {{ rs2 }}
                  </text>
                </text>
                <view v-if="item.photolist.length > 0" class="pathlist">
                  <image v-for="(pl, index2) in item.photolist" :key="index2" :class="item.photolist_cls" :src="pl"
                         mode="aspectFill"></image>
                </view>
              </view>
              <text v-if="!globalUtils.empty(item.distance_str)" class="gps">
                <text class="i ico"></text>
                {{ item.distance_str }}
              </text>
              <text class="em">
                <text class="div">{{ item.aboutus }}</text>
              </text>
              <view class="zoyq">
                <text :style="'background-color:' + color" class="li">寻觅</text>
                {{ item.zoyq }}
              </view>
            </block>

            <block v-else-if="dataObj.showtype==='3'">
              <view class="em">
                <image :src="item.photo_b" class="m" mode="widthFix"></image>
                <image v-if="!globalUtils.empty(item.vipj)" :src="item.vipj" class="vipj" mode="widthFix"></image>
              </view>
              <view class="uinfo">
                <view class="nik">
                  <view class="span">
                    <text class="h4">{{ item.nickname }}</text>
                    <image :src="item.grade_ico" class="ugrade2"></image>
                  </view>
                  <text class="font">{{ item.marrytime }}</text>
                </view>
                <view class="data">
                  <view class="span">
                    <text v-for="(item2, index2) in item.ageheighedupay" :key="index2" class="li">{{ item2 }}</text>
                  </view>
                  <view class="span">
                    <text class="i ico"></text>
                    {{ item.areatitle_str }}
                  </view>
                </view>
                <view class="about">{{ item.aboutus }}</view>
              </view>
              <image v-if="!globalUtils.empty(item.rzj)" :src="item.rzj" class="rzj" mode="aspectFill"></image>
              <view class="payrz">
                <view class="RZBOX">
                  <text v-for="(item2, index2) in item.RZarr"
                        :key="index2" :class="'i ico ' + item2.F + ' ' + item2.ed + ' ' + item2.size"></text>
                </view>
              </view>
            </block>
          </navigator>
        </block>
      </view>
      <navigator v-if="dataObj.index_ifpbl!=1" class="usermore ico" hoverClass="none" openType="switchTab"
                 url="/pages/user/user">
        <text class="span">浏览更多嘉宾</text>
        <text class="i ico"></text>
      </navigator>
    </view>
    <view v-if="loading_flag" class="loading">
      <image v-if="loading_ico_flag" class="loading_ico" src="/static/res/img/loading_ico.svg"></image>
      <text>{{ loading_str }}</text>
    </view>
    <view v-if="guestloadP_flag" class="guestloadP">
      <button
          v-if="dataObj.iflogin=='mob'"
          :style="'--color:' + color + ';--rgbcolor:' + rgbcolor"
          class="btn5"
          hoverClass="none"
          openType="getPhoneNumber"
          @getphonenumber="getPhoneNumber"
      >
        <text>微信登录</text>
        <text :style="'color: ' + color + ';'">浏览更多</text>
      </button>
      <navigator v-else-if="dataObj.iflogin=='reg'" :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" class="btn5"
                 hoverClass="none"
                 url="/pagesA/reg/reg">
        <text>完善资料</text>
        <text :style="'color: ' + color + ';'">浏览更多</text>
      </navigator>
    </view>
    <view v-if="PARTY.length > 0" :style="'margin-top:20rpx;--color:' + color + ';--rgbcolor:' + rgbcolor" class="box">
      <view class="i_box">
        <navigator class="a ed" hoverClass="none" url="/pagesA/party/party">相亲活动</navigator>
        <view class="h5">
          <text class="span">线下面对面相亲</text>
          <navigator class="a applytop" hoverClass="none" url="/pagesA/party/party">
            更多活动
            <text class="i ico"></text>
          </navigator>
        </view>
      </view>
      <view class="party">
        <view class="ul">
          <navigator v-for="(item, index) in PARTY" :key="index" :url="'/pagesA/party/party_detail?fid=' + item.id"
                     hoverClass="none">
            <image :src="item.path_b" mode="aspectFill"></image>

            <view class="div title">{{ item.title }}</view>

            <view class="div djs">
              <view class="font">
                <block v-if="item.DJS.flag == 1">
                  <text class="sapn jzbmT">
                    <text class="ico"></text>
                    {{ item.DJS.title }}
                  </text>
                  <block v-for="(item2, index1) in item.DJS.djstime" :key="index1">
                    <text class="sapn timestyle">{{ item2.num }}</text>

                    {{ item2.t }}
                  </block>
                </block>
                <block v-else>{{ item.DJS.title }}</block>
              </view>
            </view>

            <view class="div address">
              <text class="i ico"></text>
              {{ item.address }}
            </view>
          </navigator>
        </view>
      </view>
    </view>
    <view v-if="HN.length > 0" :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" class="box margintop40">
      <view class="i_box">
        <navigator class="a ed" hoverClass="none" openType="switchTab" url="/pages/hn/hn">情感顾问团队</navigator>
        <view class="h5">
          <text class="span">线下一对一服务</text>
          <navigator class="a applytop" hoverClass="none" openType="switchTab" url="/pages/hn/hn">
            更多情感顾问
            <text class="i ico"></text>
          </navigator>
        </view>
      </view>
      <view class="hnlist">
        <navigator v-for="(item, index) in HN" :key="index" :url="'/hnPages/hn_detail/hn_detail?id=' + item.id"
                   class="li"
                   hoverClass="none">
          <image :src="item.path_b" mode="aspectFill"></image>

          <view class="h2">{{ item.truename }}</view>

          <view class="h4">{{ item.title }}</view>

          <view class="span add">
            <text class="i ico"></text>
            找{{ item.sex_str }}牵线
          </view>
        </navigator>
      </view>
    </view>
    <view v-if="!globalUtils.empty(WZ) && WZ.list.length > 0" :style="'--color:' + color + ';--rgbcolor:' + rgbcolor"
          class="box">
      <view class="i_box">
        <navigator class="a ed" hoverClass="none" url="/pagesA/article/article">婚恋学堂</navigator>
        <view class="h5">
          <text class="span">教您如何谈恋爱</text>
          <navigator class="a applytop" hoverClass="none" url="/pagesA/article/article">
            更多文章
            <text class="i ico"></text>
          </navigator>
        </view>
      </view>
      <view class="iarticle">
        <view class="kind">
          <view v-for="(item, index) in WZ.kind" :key="index" :class="'a ' + item.class" :data-kind="item.id"
                @tap="WZkindFn">{{ item.kindtitle }}
          </view>
        </view>
        <navigator v-for="(item, index) in WZ.list" :key="index" :url="'/pagesA/article/article_detail?id=' + item.id"
                   class="li" hoverClass="none">
          <image :src="item.path_s" mode="aspectFill"></image>

          <view class="em">
            <view class="h4">{{ item.title }}</view>
            <view class="div">
              <text class="span">
                <text class="i ico"></text>
                {{ item.click }}
              </text>
              <text class="font">{{ item.addtime }}</text>
            </view>
          </view>
        </navigator>
      </view>
    </view>
    <view v-if="dataObj.index_ifpbl!=1&&!globalUtils.empty(dataObj)"
          :style="'--color:' + color + ';--rgbcolor:' + rgbcolor"
          class="zeai_bottom">
      <view v-if="(!globalUtils.empty(dataObj.tel))" class="tel">
        幸福热线：
        <text @tap="telFn">{{ dataObj.tel }}</text>
      </view>
      <view class="aboutus">
        <navigator hoverClass="none" openType="switchTab" url="/pages/index/index4">首页</navigator>
        <text class="b">|</text>
        <navigator hoverClass="none" url="/pagesA/about/about?t=us">关于我们</navigator>
        <text class="b">|</text>
        <navigator hoverClass="none" url="/pagesA/about/about?t=contact">联系方式</navigator>
        <text class="b">|</text>
        <navigator hoverClass="none" url="/pagesA/about/about?t=news">平台公告</navigator>
      </view>
      {{ m_bottom }}
      <rich-text :nodes="m_bottom" class="m_bottom"></rich-text>
      <view v-if="(!globalUtils.empty(dataObj.wxpic))" class="ewm">
        <image :showMenuByLongpress="true" :src="dataObj.wxpic" mode="aspectFill"></image>
        <view class="font">扫一扫，缘分到</view>
      </view>
    </view>


    <navigator :style="'--color:' + color + ';--rgbcolor:' + rgbcolor" class="btmKefuBtn loop_s_b_s"
               url="/pagesA/about/about">
      <view class="i ico"></view>
      客服
    </navigator>
    <view v-if="backtop_flag" :style="'color:' + color" class="backtop fadeInUp" data-id="index" @tap="backtopFn">
      <text class="ico icon-backtop"></text>
      顶部
    </view>
    <view class="blank"></view>
    <privacy-popup @agree="privacy_agree" @disagree="privacy_disagree"></privacy-popup>
  </view>
</template>

<script>
import privacyPopup from '../../components/privacyPopup/privacyPopup';
import globalUtils from "../../res/www.a9a.cn";
import Member from "../../components/member/member.vue";

var app = getApp();
var a;
var t = require('../../@babel/runtime/helpers/defineProperty');
var i = 2;
var o = true;
export default {
  components: {
    Member,
    privacyPopup
  },
  data() {
    return {
      aid: 0,
      agent_class: 'agent',
      agentbox: false,
      currentTab: 0,
      topbar2_btm: 0,
      if_div_top: false,
      TOP3loading: false,
      loading_flag: false,
      loading_ico_flag: false,
      loading_str: '玩命加载中',
      ARR_index: [],
      waterfallList: [], // 瀑布留列表
      ARR_index_nodata: false,
      guestloadP_flag: false,
      sokind: '',
      backtop_flag: false,
      topbar2: false,
      color: '',
      rgbcolor: '',
      nikbg: '',
      agentbox_mask_class: '',
      agentbox_box_class: '',
      banner_W: '',
      banner_H: 120,
      div_top_mask_class: '',
      div_top_box_class: '',
      nTop: 0,
      nHeight: '',
      topbar: [],
      nTH: 0,
      TRnav: [],
      AGENT: {
        list: [],
        tbody: ''
      },
      banner: [],
      banner_idx: 0,
      navdiy_index: [],
      IZT: {
        party: {
          id: '',
          path_s: '',
          title: '',
          ulist: []
        },
        huxuan: {
          id: '',
          path_s: '',
          title: '',
          ulist: []
        },

        manghe: {
          id: '',
          path_s: '',
          title: '',
          ulist: []
        }
      },
      TOP3: [],
      RENQI: {}, // 排行榜列表
      rankingActiveIndex: 0, // 选择排行榜
      dl: [],
      rs2: [],
      pl: '',
      PARTY: [],
      HN: [],

      WZ: {
        list: [],
        kind: []
      },
      m_bottom: '',
      dataObj: {}, // 首页数据
      rq: 0, // 榜单ID
    };
  },
  computed: {
    globalUtils() {
      return globalUtils
    },
  },
  onLoad: function (a) {
    const that = this;
    this.onLoadClone3389(a);
    app.globalData.get_openid().then(function (a) {
      that.init();
    });
  },
  onShow: function () {
    const that = this;
    console.log('这是什么aid',app.globalData.aid)
    if (that.aid !== app.globalData.aid) {
      that.setData({
        aid: app.globalData.aid
      });
      return void uni.startPullDownRefresh();
    }
    a = uni.getStorageSync('COOK_U');
    app.globalData.empty(a) ||
    app.globalData.ajax({
      url: 'index4.php',
      data: {
        submitok: 'onshow',
        openid: a.openid,
        unionid: a.unionid,
        aid: app.globalData.aid
      },
      success: function (n) {
        console.log('这是获取什么数据',n )
        if (1 == n.flag && n.cook_flag != a.flag) {
          a.flag = n.cook_flag;
          uni.setStorageSync('COOK_U', a);
          return void uni.startPullDownRefresh();
        }
      }
    });
  },
  onPullDownRefresh: function () {
    var that = this;
    this.agentbox_close_Fn();
    uni.vibrateShort({
      type: 'heavy'
    });
    setTimeout(function () {
      that.setData({
        loading_flag: false,
        loading_str: '拼命加载中',
        ARR_index: [],
        waterfallList: [],
        ARR_index_nodata: false,
        guestloadP_flag: false,
        sokind: '',
        currentTab: 0
      });
      i = 2;
      o = true;
      uni.stopPullDownRefresh();
      that.init();
    }, 100);
  },
  onReachBottom: function (n) {
    if (1 == this.dataObj.index_ifpbl) {
      var s = this.ARR_index;
      var that = this;
      if (o) {
        o = false;
        that.setloading('start', '玩命加载中');
        var l = {
          submitok: 'list',
          p: i,
          openid: a.openid,
          aid: app.globalData.aid
        };
        app.globalData.ajax({
          url: 'index4.php',
          data: l,
          success: function (a) {
            if (i > that.dataObj.guestloadP && 1 != that.dataObj.iflogin) {
              that.setloading('stop', '请登录/注册');
              o = false;
              return void that.setData({
                guestloadP_flag: true
              });
            }
            if (1 == a.flag) {
              var n = s.length;
              if (a.ULIST.length < 1) {
                that.setloading('end', '已全部加载完毕');
                return void (o = false);
              }
              that.setData(t({}, 'ARR_index[' + n + ']', a.ULIST));
              i += 1;
              o = true;
            } else {
              uni.showToast({
                title: a.msg,
                icon: 'none',
                mask: true
              });
            }
            that.setloading('end', '上拉加载更多');
          }
        });
      }
    }
  },
  onPageScroll: function (a) {
    a.scrollTop > 100
        ? this.setData({
          backtop_flag: true,
          topbar2: true,
          topbar2_btm: 10
        })
        : this.setData({
          backtop_flag: false,
          topbar2: false,
          topbar2_btm: 0
        });
  },
  onShareAppMessage: function () {
    return {
      imageUrl: this.dataObj.share.imgurl,
      title: this.dataObj.share.title,
      path: '/pages/index/index4?aid=' + app.globalData.aid
    };
  },
  onShareTimeline: function () {
    return {
      imageUrl: this.dataObj.share.imgurl,
      title: this.dataObj.share.title,
      query: 'aid=' + app.globalData.aid,
      path: '/pages/index/index4'
    };
  },
  methods: {
    atop() {
      uni.navigateTo({
        url: '/pagesA/form/form_detail?fid=1&admid=1'
      })
    },
    onLoadClone3389: function (a) {
      var that = this;
      if (globalUtils.empty(app.globalData.aid)) {
        var i = globalUtils.set_options_aid(that, a);
      }
      app.globalData.get_config('_ZEAI').then(function (a) {
        that.setData({
          aid: i,
          color: app.globalData._ZEAI.color,
          rgbcolor: globalUtils.c16_rgb(app.globalData._ZEAI.color),
          nikbg: app.globalData.WWW + '/res/m/img/nikbg.png'
        });
        globalUtils.set_tabbar();
      });
      app.globalData.get_navigationBarTopHeight(that);
      o = true;
      app.globalData.chklogin().then(function (a) {
      });
    },
    agentboxFn: function () {
      var a;
      var t;
      if ('agented' == this.agent_class) {
        t = false;
        a = 'agent';
      } else {
        a = 'agented';
        t = true;
      }
      this.setData({
        agent_class: a,
        agentbox: t,
        agentbox_mask_class: 'alpha0_100',
        agentbox_box_class: 'divTopDown'
      });
    },

    agentbox_close_Fn: function () {
      var that = this;
      this.setData({
        agentbox_box_class: 'divTopUp',
        agent_class: 'agent'
      });
      setTimeout(function () {
        that.setData({
          agentbox_mask_class: 'alpha100_0'
        });
      }, 200);
      setTimeout(function () {
        that.setData({
          agentbox: false
        });
      }, 400);
    },

    aidFn: function (a) {
      var t = a.currentTarget.dataset.aid;
      globalUtils.set_options_aid(this, {
        aid: t
      });
      uni.startPullDownRefresh();
      this.agentbox_close_Fn();
    },

    agent_detailFn: function (a) {
      var t = a.currentTarget.dataset.aid;
      if (globalUtils.empty(t)) {
        uni.navigateTo({
          url: '/pagesA/about/about?t=us'
        });
      } else {
        uni.navigateTo({
          url: '/hnPages/agent/detail?id=' + t
        });
      }
    },

    aidmoreFn: function () {
      this.agentbox_close_Fn();
      uni.navigateTo({
        url: '/hnPages/agent/index'
      });
    },

    init: function () {
      var that = this;
      var o = {
        submitok: 'index',
        openid: (a = uni.getStorageSync('COOK_U')).openid,
        unionid: a.unionid,
        aid: app.globalData.aid,
        rq: that.rq,
      };
      uni.showLoading({
        title: '玩命加载中',
        mask: true
      });
      app.globalData.ajax({
        url: 'index4.php',
        data: o,
        success: function (e) {
          uni.hideLoading();
          // if (e.cook_flag != a.flag && !that.singlePage) {
          //   a.flag = e.cook_flag;
          //   uni.setStorageSync('COOK_U', a);
          //   return void that.onLoadClone3389({});about
          // }
          if (1 == e.flag) {
            var o = e.banner;
            if (!globalUtils.empty(e.var.m_bottom)) {
              var s = globalUtils.escape2Html(e.var.m_bottom);
            }
            that.setData(
                t(
                    {
                      topbar: e.topbar,
                      navdiy_index: e.navdiy_index,
                      TRnav: e.TRnav,
                      banner: o,
                      IZT: e.IZT,
                      TOP3: e.TOP3,
                      RENQI: e.RENQI,
                      PARTY: e.PARTY,
                      HN: e.HN,
                      WZ: e.WZ,
                      m_bottom: s,
                      dataObj: e.var,
                      AGENT: e.AGENT,
                      waterfallList: e.ULIST,
                    },
                    'ARR_index[0]',
                    e.ULIST,
                )
            );
            if (o.length > 0) {
              globalUtils.o('#img0', function (a) {
                if (a) return
                that.setData({
                  banner_W: a[0].width,
                  banner_H: 0.288 * a[0].width
                });
              });
            }
            var r = globalUtils.get_tabbar_index('my_msg');
            e.btmnewnum > 0
                ? uni.setTabBarBadge({
                  index: r,
                  text: e.btmnewnum
                })
                : uni.removeTabBarBadge({
                  index: r
                });
          } else {
            uni.showToast({
              title: e.msg,
              icon: 'none',
              mask: true
            });
          }
        }
      });
    },

    setloading: function (a, t) {
      'start' == a
          ? this.setData({
            loading_flag: true,
            loading_ico_flag: true,
            loading_str: t
          })
          : this.setData({
            loading_flag: false,
            loading_ico_flag: false,
            loading_str: t
          });
    },

    getPhoneNumber: function (a) {
      app.globalData.getPhoneNumber({
        e: a,
        url: '/pagesA/reg/reg'
      });
    },

    topbarFn: function (a) {
      var t = a;
      switch ((this.backtopFn(), t)) {
        case 'trend':
          uni.navigateTo({
            url: '/pagesA/trend/trend'
          });
          break;
        case 'emotion':
          uni.navigateTo({
            url: '/pagesA/emotion/emotion'
          });
          break;
        case 'izt':
          uni.navigateTo({
            url: '/pagesA/izt/izt'
          });
      }
    },

    topbar_moreFn: function () {
      this.setData({
        if_div_top: true,
        div_top_mask_class: 'alpha0_100',
        div_top_box_class: 'divTopDown'
      });
    },

    div_top_close_Fn: function () {
      var that = this;
      this.setData({
        div_top_box_class: 'divTopUp'
      });
      setTimeout(function () {
        that.setData({
          div_top_mask_class: 'alpha100_0'
        });
      }, 200);
      setTimeout(function () {
        that.setData({
          if_div_top: false
        });
      }, 400);
    },

    blankFn: function () {
    },

    top3Fn: function () {
      var that = this;
      that.setData({
        TOP3loading: true
      });
      app.globalData.ajax({
        url: 'index4.php',
        data: {
          submitok: 'top3',
          openid: a.openid,
          aid: app.globalData.aid
        },
        success: function (a) {
          1 == a.flag
              ? that.setData(t({}, 'TOP3', a.TOP3))
              : uni.showToast({
                title: a.msg,
                icon: 'none',
                mask: true
              });
          that.setData({
            TOP3loading: false
          });
        }
      });
    },
    // 切换排行榜
    onTabs(item, i) {
      const that = this;
      this.rankingActiveIndex = i
      var o = {
        submitok: 'index',
        openid: (a = uni.getStorageSync('COOK_U')).openid,
        unionid: a.unionid,
        aid: app.globalData.aid,
        rq: item.id,
      };

      app.globalData.ajax({
        url: 'index4.php',
        data: o,
        success: function (e) {
          that.RENQI = e.RENQI;
        }
      });
    },
    // 排行榜
    onRanking() {
      uni.navigateTo({
        url: '/pagesA/rankingList/rankingList'
      });
    },
    WZkindFn: function (a) {
      var t = a.currentTarget.dataset.kind;
      uni.navigateTo({
        url: '/pagesA/article/article?kind=' + t
      });
    },

    index_parFn: function (a) {
      var t = a.currentTarget.dataset.sokind;
      var n = a.currentTarget.dataset.sex;
      app.globalData.index_par = {
        sokind: t,
        sex: n
      };
      uni.switchTab({
        url: '../user/user'
      });
    },

    backtopFn: function (a) {
      uni.pageScrollTo({
        scrollTop: 0,
        duration: 300
      });
    },

    telFn: function (a) {
      uni.makePhoneCall({
        phoneNumber: this.dataObj.tel
      });
    },

    privacy_agree: function (a) {
    },

    privacy_disagree: function (a) {
      uni.exitMiniProgram();
    },

  }
};
</script>
<style scoped lang="scss">
@import './index4.scss';
</style>
